import * as THREE from 'three';

// 自定义点
const bufferGeometry = new THREE.BufferGeometry();
const vertiecs = new Float32Array([
    0,0,0,
    100,0,0,
    0,100,0,

    // 0,100,0,
    100,100,0,
    // 100,0,0,
]);
const attributes = new THREE.BufferAttribute(vertiecs, 3);
bufferGeometry.setAttribute('position', attributes);
const indexs = new Uint16Array([
    0, 1, 2,
    2, 3, 1,
]);
bufferGeometry.setIndex(new THREE.BufferAttribute(indexs,1));

// 从相机看过去的方向，如果一个三角形是逆时针连接的顶点，就是正面，顺时针就是反面。
// 正面会渲染，反面不会渲染。
const material = new THREE.MeshBasicMaterial({
    color: 0x00ff00,
    wireframe: true,  // 线框模式
    side: THREE.DoubleSide, // 双面渲染
});
const mesh = new THREE.Mesh(bufferGeometry, material);

// 平面缓冲几何体
const planeGeometry = new THREE.PlaneGeometry(100, 100);
const planeMaterial = new THREE.MeshBasicMaterial({
    color: new THREE.Color('orange'),
    wireframe: true,
});
// const mesh = new THREE.Mesh(planeGeometry, planeMaterial);

//
const boxGeometry = new THREE.BoxGeometry(100, 100, 100);
const boxMaterial = new THREE.MeshBasicMaterial(({
    color: new THREE.Color('orange'),
    wireframe: true
}));
// const mesh = new THREE.Mesh(boxGeometry, boxMaterial);

console.log(mesh);

export default mesh;